$(function() {
	$("#datagrid_list").datagrid({
		url : '/financial/feelist.json',
		rownumbers : true,
		singleSelect : true,
		border : false,
		pagination : true,
		toolbar : '#tb',
		pageSize : 20,
		columns : [ [ {
			field : "flowId",
			title : "",
			hidden : true
		}, {
			field : "custName",
			title : "经销商"
		}, {
			field : "flowChannel",
			title : "渠道"
		}, {
			field : "flowType",
			title : "类型"
		}, {
			field : "flowChangedFee",
			title : "金额",
			formatter : function(value, row, index) {
				return value.toFixed(2);
			}
		}, {
			field : "flowRoyaltyPayee",
			title : "分润给"
		}, {
			field : "flowRoyaltyFee",
			title : "分润金额",
			formatter : function(value, row, index) {
				return value.toFixed(2);
			}
		}, {
			field : "flowMemo",
			title : "备注"
		}, {
			field : "flowPayNo",
			title : "支付交易号"
		}, {
			field : "flowPaidOn",
			title : "交易时间"
		} ] ],
		onLoadSuccess : function(data) {
			tb_Reloadinit();
		}
	});

});
function onSelectBegin(date) {
	$('begin').val(date);
}

function onSelectEnd(date) {
	$('end').val(date);
}

function searchit() {
	var name = $.trim($("#name").val());
	var tno = $.trim($("#tno").val());
	var begin = $.trim($("input[name='begin']").val());
	var end = $.trim($("input[name='end']").val());
	var ono = $.trim($("#ono").val());
	var feeType = $.trim($("#type").val());
	var channel = $.trim($("#channel").val());
	if (name == "" && tno == "" && begin == "" && end == "" && ono == ""
			&& feeType == "" && channel == "") {
		alert("请输入查询条件!");
		return;
	}
	var opts = $('#datagrid_list').datagrid("options");
	opts.url = "/financial/feelist.json";
	$('#datagrid_list').datagrid('load', {
		"name" : name,
		"tno" : tno,
		"begin" : begin,
		"end" : end,
		"ono" : ono,
		"channel" : channel,
		"feeType" : feeType
	});
}